<template>
  <div class="ma-content-block lg:flex justify-between p-4">
    <!-- CRUD 组件 -->
    <ma-crud :options="options" :columns="columns" ref="crudRef">
    </ma-crud>
  </div>
</template>
<script setup>
import { ref, reactive } from 'vue'
import lzccTaskFolder from '@/api/lzcc/lzccTaskFolder'
import { Message } from '@arco-design/web-vue'
import tool from '@/utils/tool'
import * as common from '@/utils/common'

const crudRef = ref()

const options = reactive({
  id: 'flyos_lzcc_task_folder',
  rowSelection: {
    showCheckedAll: true
  },
  pk: 'id',
  operationColumn: true,
  operationWidth: 160,
  formOption: {
    viewType: 'modal',
    width: 600
  },
  api: lzccTaskFolder.getList,
  add: {
    show: true,
    api: lzccTaskFolder.save,
    auth: ['lzcc:taskFolder:save']
  },
  edit: {
    show: true,
    api: lzccTaskFolder.update,
    auth: ['lzcc:taskFolder:update']
  },
  delete: {
    show: true,
    api: lzccTaskFolder.deletes,
    auth: ['lzcc:taskFolder:delete']
  },
  import: {
    show: true,
    url: 'lzcc/taskFolder/import',
    templateUrl: 'lzcc/taskFolder/downloadTemplate',
    auth: ['lzcc:taskFolder:import']
  },
  export: {
    show: true,
    url: 'lzcc/taskFolder/export',
    auth: ['lzcc:taskFolder:export']
  }
})

const columns = reactive([
  {
    title: "ID",
    dataIndex: "id",
    formType: "input",
    addDisplay: false,
    editDisplay: false
  },
  {
    title: "文件夹名称",
    dataIndex: "name",
    searchLabelWidth: '0px',
    formType: "input",
    search: true,
    commonRules: {
      required: true,
      message: "请输入文件夹名称"
    }
  },
  {
    title: "类型",
    dataIndex: "type",
    formType: "radio",
    search: true,
    commonRules: {
      required: true,
      message: "请输入类型"
    },
    dict: {
      data: [
        {
          label: "集装箱",
          value: "1"
        },
        {
          label: "车号",
          value: "2"
        }
      ],
      translation: true
    }
  },
  {
    title: "创建时间",
    dataIndex: "created_at",
    formType: "date",
    addDisplay: false,
    editDisplay: false,
    showTime: true
  },
  {
    title: "更新时间",
    dataIndex: "updated_at",
    formType: "date",
    addDisplay: false,
    editDisplay: false,
    hide: true,
    showTime: true
  },
  {
    title: "创建者",
    dataIndex: "created_by",
    formType: "input",
    addDisplay: false,
    editDisplay: false,
    hide: true
  },
  {
    title: "更新者",
    dataIndex: "updated_by",
    formType: "input",
    addDisplay: false,
    editDisplay: false,
    hide: true
  }
])
</script>
<script> export default { name: 'lzcc:taskFolder' } </script>